import React from 'react';
import { Router, Route, Switch } from 'react-router-dom';
import Loading from './components/Loading';
import history from './utils/history';
const Layout = React.lazy(() => import('@/pages/Layout'));
const Login = React.lazy(() => import('@/pages/Login'));
const Search = React.lazy(() => import('@/pages/Search'));
const ProfileEdit = React.lazy(() => import('@/pages/Profile/Edit'));
const Test = React.lazy(() => import('@/pages/test'));

export default function App() {
  return (
    <div>
      <Router history={history}>
        <React.Suspense fallback={<Loading />}>
          <Switch>
            <Route path="/login" component={Login} />
            <Route path="/search" component={Search} />
            <Route path="/profile/edit" component={ProfileEdit} />
            <Route path="/test" component={Test} />
            <Route path="/" component={Layout} />
          </Switch>
        </React.Suspense>
      </Router>
    </div>
  );
}
